import { Component, Label, _decorator } from 'cc';
import { GameMgr } from '../game/GameMgr';
const { ccclass, property } = _decorator;

@ccclass("UIScore")
export class UIScore extends Component {

    @property(Label)
    labScore: Label;

    protected update(dt: number) {
        const game = GameMgr.ins;
        const snake = game.snakeMgr.snakeMap.get(game.snakeId);
        if (snake) {
            this.labScore.string = Math.floor(snake.data.score) + "";
        }
    }

}